Skip to content
View Article Network

On jQuery

Introduction

Current .NET web architectures can generally be divided into the following two types:

  1. Using .NET framework's MVC or Razor Pages.
  2. Using frontend frameworks in combination with Web APIs.

For a backend-focused web engineer, if one wants to develop a website independently, the first option is usually chosen. As for learning frontend frameworks, just a quick Google search reveals their rapid update cycles, along with various build tools and new technical jargon, which might lead one to give up before even getting started (oops). Before the emergence of frontend frameworks, the mainstream frontend tool for the first approach was jQuery.

Analysis of jQuery's Pros and Cons

The advantages are as follows:

AdvantageDescriptionCurrent Status
Cross-browser syntax integrationIn the early days, JavaScript implementations varied across browsers, often requiring checks for browser versions to write different syntax—especially with the significant gap between IE and other browsers. jQuery provided a series of APIs to handle these cross-browser implementation differences, significantly lowering the barrier to entry for JavaScript at the time.Most mainstream browsers now implement according to W3C standards. With IE retired, the impact of browser differences is becoming increasingly minimal.
Simple and rich APIs for DOM manipulationEarly APIs were quite limited; for example, to find a DOM element, there was only getElementById() and similar. jQuery provided Selector expressions to find DOM elements in various ways.Most of the APIs provided by jQuery have subsequently been incorporated into native browser APIs.
Rich ecosystem of pluginsDue to early browser compatibility issues and the scarcity of native APIs, many subsequent plugins were built to depend on jQuery.New versions of plugins are now starting to move away from jQuery dependencies, such as Bootstrap 5.

The disadvantages are as follows:

  1. jQuery 4 is nowhere in sight: Looking at the history of jQuery, one can see that after the release of version 3.4 in April 2019, subsequent updates have mostly been for security purposes, making it difficult to expect major functional enhancements in the future. However, as of version 3.6, it is still being maintained, so security concerns should not be an immediate issue.

  2. Loose structure that is difficult to manage: jQuery is, after all, just a library, not a complete framework; the quality of the code depends heavily on the developer's skill.

From 2011 to 2022, there is no denying that jQuery held a very important position in past work. However, in recent years, as reliance on jQuery has decreased, one must consider whether it is still worth continuing to use.

Alternatives to jQuery

  1. Vue The mainstream frontend frameworks are React, Angular, and Vue. Among them, Vue is a progressive framework. Currently, it is the only one that can be used by simply referencing a JS file, allowing one to avoid the learning curve of frontend tools like webpack, while focusing the scope of use solely on UI presentation, making it easier to integrate with other libraries.

  2. ASP.NET Core Blazor Uses C# instead of JavaScript to build rich, interactive UIs.

Conclusion

For current development, using Vue to replace jQuery is my choice, as switching directly to ASP.NET Core Blazor feels like too big of a leap. However, Vue 3's shift to the Composition API has made me feel somewhat unadapted. After all, when frontend frameworks started to become popular, apart from studying Vue 2, I had already started to reduce my focus on frontend advancement, and the Composition API feels like another world to me. To continue using .NET's Model Validation, I am currently choosing to develop websites using the older Vue 2 and VeeValidate 2. However, with the evolution of subsequent versions and coding styles, if I still cannot adapt to new methods and cannot find a suitable Validate JS (the reason for not finding a replacement for VeeValidate 2 is more significant), I have started to consider switching to ASP.NET Core Blazor.

Changelog

    • Initial document creation.